﻿function expandCollapse(clientID, expandedClass, collapsedClass) {
    var caption = "#" + clientID + "_caption";
    var contents = "#" + clientID + "_contents";

    if ($(contents).css("display") != "none") {
        // currently expanded. need to collapse
        $(contents).slideUp();
        $(caption).removeClass(expandedClass);
        $(caption).addClass(collapsedClass);
    } else {
        // currently collapsed. expanding
        $(contents).slideDown();
        $(caption).removeClass(collapsedClass);
        $(caption).addClass(expandedClass);
    }
}